feat: ETL migration, MPMC logging, device framework overhaul, VFS/FatFS, and coding standards#193
Merged
MRNIU merged 3891 commits intoSimple-XX:mainfrom Mar 18, 2026
Merged
feat: ETL migration, MPMC logging, device framework overhaul, VFS/FatFS, and coding standards#193MRNIU merged 3891 commits intoSimple-XX:mainfrom
MRNIU merged 3891 commits intoSimple-XX:mainfrom
Conversation
Replace raw new TaskControlBlock with sk_std::make_unique and .release() before passing to AddTask. Ensures exception-safe construction while maintaining AddTask's raw pointer interface. Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Add comprehensive ETL migration plan (Tasks 0-10) for replacing sk_std:: containers with ETL-backed kstd:: wrappers. Remove superseded unique_ptr design/implementation docs. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Add etl::etl to kernel link libraries in compile_config.cmake. Add etl_profile.h with ETL_CPP23_SUPPORTED and ETL_NO_CHECKS defines. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Add kstd namespace wrappers around ETL containers: - kstd_pool.hpp: Pool<T,N> and PoolRef type aliases - kstd_vector: vector, static_vector, ivector - kstd_list: list, static_list, list_node_t - kstd_unique_ptr: custom unique_ptr implementation - kstd_priority_queue: reference-based priority queue - kstd_unordered_map: pool-backed unordered_map with std::hash Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Replace sk_std:: implementations with thin forwarding shims to kstd:: namespace. sk_vector, sk_list, sk_unique_ptr, sk_priority_queue, and sk_unordered_map now delegate to ETL-backed kstd wrappers. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Replace sk_std:: containers with kstd:: static containers in schedulers and task manager. Use static_vector, static_list, and static_unordered_map with compile-time sizes. Mark scheduler copy/move as deleted since ETL containers with internal storage are not copyable. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Delete sk_shared_ptr, sk_set, sk_rb_tree, and sk_queue which have no remaining consumers after the ETL migration. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Remove unit and system tests for sk_queue, sk_rb_tree, sk_set, and sk_shared_ptr. Update test CMakeLists.txt and system_test registration to reflect 22 remaining test cases. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…/Write helpers Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…Read/Write Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…c xAPIC branches Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…lkDriver::Probe Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…uler Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…nScheduler Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…y_queue in CfsScheduler Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
… CpuSchedData Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
There was a problem hiding this comment.
Pull request overview
Large refactor to migrate core kernel infrastructure to ETL, introduce a new device framework, and add a VFS layer with RamFS/FatFS integration (plus build-system updates to support the new components).
Changes:
- Replace multiple custom utilities (singletons, IO access, logging formatting) with ETL-based equivalents.
- Add new device framework (bus enumeration + driver registry) and unified VirtIO driver with VFS block-device adapter.
- Add VFS + RamFS + FatFS filesystem stack and update build/QEMU tooling to generate and attach a root filesystem image.
Reviewed changes
Copilot reviewed 175 out of 327 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| src/include/kernel_elf.hpp | Switch to #pragma once, ETL singleton alias, log formatting updates, member renames. |
| src/include/kernel_config.hpp | New kernel-wide sizing constants for tasks/observers. |
| src/include/kernel.h | Add DeviceInit() / FileSystemInit() declarations and switch to trailing return style. |
| src/include/io_buffer.hpp | New IoBuffer/DmaRegion interfaces for DMA-safe buffers. |
| src/include/io.hpp | Remove legacy raw MMIO helpers (replaced by ETL IO ports). |
| src/include/interrupt_base.h | Introduce etl::delegate-based handlers and external IRQ registration API. |
| src/include/config.h | Remove legacy config include shim. |
| src/include/basic_info.hpp | Switch to ETL singleton alias and modernize struct initialization. |
| src/filesystem/vfs/write.cpp | New VFS write syscall entry with permission checks. |
| src/filesystem/vfs/vfs_internal.hpp | Internal VFS helpers and global state definition. |
| src/filesystem/vfs/vfs.cpp | Core VFS state + helper implementations + Init. |
| src/filesystem/vfs/unlink.cpp | New unlink implementation using dentries/inode ops. |
| src/filesystem/vfs/seek.cpp | New seek implementation with fallback default behavior. |
| src/filesystem/vfs/rmdir.cpp | New rmdir implementation with empty-dir check. |
| src/filesystem/vfs/readdir.cpp | New readdir wrapper enforcing directory type. |
| src/filesystem/vfs/read.cpp | New read wrapper. |
| src/filesystem/vfs/open.cpp | New open/create path using lookup + inode ops. |
| src/filesystem/vfs/mkdir.cpp | New mkdir implementation building dentries from inode ops. |
| src/filesystem/vfs/lookup.cpp | New path resolver with mount-point support and dentry caching. |
| src/filesystem/vfs/include/mount.hpp | New mount table + mount-point structures. |
| src/filesystem/vfs/include/filesystem.hpp | New filesystem interface for mount/sync/inode management. |
| src/filesystem/vfs/include/block_device.hpp | New block-device abstraction for FS adapters. |
| src/filesystem/vfs/close.cpp | New close wrapper with refcount decrement. |
| src/filesystem/vfs/CMakeLists.txt | Build rules for VFS interface target. |
| src/filesystem/ramfs/CMakeLists.txt | Build rules for RamFS interface target. |
| src/filesystem/include/file_descriptor.hpp | New per-task FD table interface. |
| src/filesystem/filesystem.cpp | FileSystemInit() mounting RamFS + optional FatFS on VirtIO blk. |
| src/filesystem/file_descriptor.cpp | FD table implementation (alloc/free/dup/close-all). |
| src/filesystem/fatfs/include/ffconf.h | FatFS configuration provided via forced include. |
| src/filesystem/fatfs/diskio.cpp | FatFS disk HAL wired to vfs::BlockDevice. |
| src/filesystem/fatfs/CMakeLists.txt | Build rules for FatFS wrapper + forced config include. |
| src/filesystem/CMakeLists.txt | Aggregate filesystem target linking VFS/RamFS/FatFS/device. |
| src/filesystem/AGENTS.md | Documentation for new filesystem architecture and conventions. |
| src/driver/pl011/pl011.cpp | Remove legacy PL011 driver implementation (moved to new device framework). |
| src/driver/pl011/include/pl011.h | Remove legacy PL011 interface. |
| src/driver/pl011/README.md | Remove legacy PL011 docs. |
| src/driver/pl011/CMakeLists.txt | Remove old PL011 CMake target. |
| src/driver/ns16550a/ns16550a.cpp | Remove legacy NS16550A driver implementation (moved to new device framework). |
| src/driver/ns16550a/include/ns16550a.h | Remove legacy NS16550A interface. |
| src/driver/ns16550a/README.md | Remove legacy NS16550A docs. |
| src/driver/ns16550a/CMakeLists.txt | Remove old NS16550A CMake target. |
| src/driver/include/driver.h | Remove legacy driver entrypoint. |
| src/driver/driver.cpp | Remove legacy driver stub. |
| src/driver/acpi/acpi.cpp | Remove legacy ACPI stub implementation. |
| src/driver/acpi/README.md | Remove legacy ACPI docs. |
| src/driver/acpi/CMakeLists.txt | Remove legacy ACPI target. |
| src/driver/README.md | Remove legacy driver directory README. |
| src/driver/CMakeLists.txt | Remove legacy driver umbrella library. |
| src/device/virtio/virtio_driver.cpp | New unified VirtIO probe and block-device exposure through DeviceNode. |
| src/device/virtio/virt_queue/virtqueue_base.hpp | New virtqueue base using C++23 explicit object parameter patterns. |
| src/device/virtio/virt_queue/misc.hpp | New virtqueue misc helpers (AlignUp, IoVec, etc.). |
| src/device/virtio/transport/pci.hpp | Placeholder PCI transport implementation. |
| src/device/virtio/device/net/virtio_net.h | Placeholder VirtIO net header. |
| src/device/virtio/device/input/virtio_input.h | Placeholder VirtIO input header. |
| src/device/virtio/device/gpu/virtio_gpu.h | Placeholder VirtIO GPU header. |
| src/device/virtio/device/console/virtio_console.h | Placeholder VirtIO console header. |
| src/device/virtio/device/blk/virtio_blk_vfs_adapter.hpp | Adapter exposing VirtIO blk via vfs::BlockDevice. |
| src/device/virtio/defs.h | VirtIO device IDs and reserved feature bits. |
| src/device/virtio/CMakeLists.txt | Build rules for VirtIO driver target. |
| src/device/pl011/pl011_driver.hpp | New PL011 driver entry for device framework. |
| src/device/pl011/CMakeLists.txt | Build rules for PL011 driver target. |
| src/device/ns16550a/ns16550a_driver.hpp | New NS16550A driver entry for device framework. |
| src/device/ns16550a/CMakeLists.txt | Build rules for NS16550A driver target. |
| src/device/include/platform_bus.hpp | New FDT-based platform bus enumerator. |
| src/device/include/device_node.hpp | New DeviceNode schema + bus concept. |
| src/device/include/device_manager.hpp | New device manager singleton managing nodes and drivers. |
| src/device/device_manager.cpp | Implement ProbeAll / lookups for device manager. |
| src/device/device.cpp | DeviceInit() entrypoint registering drivers and enumerating platform bus. |
| src/device/acpi/acpi_driver.hpp | New ACPI driver header placeholder. |
| src/device/acpi/acpi.hpp | ACPI table structures migrated to new device folder + modernized packing. |
| src/device/acpi/CMakeLists.txt | Build rules for ACPI driver target. |
| src/device/CMakeLists.txt | Aggregate device target linking all driver targets. |
| src/device/AGENTS.md | Documentation for new device framework architecture/conventions. |
| src/arch/x86_64/timer.cpp | Modernize signatures and remove legacy singleton include. |
| src/arch/x86_64/syscall.cpp | Modernize syscall handler signature. |
| src/arch/x86_64/sipi.h | Remove duplicate SIPI header (moved under include/). |
| src/arch/x86_64/macro.S | Remove stale brief comment. |
| src/arch/x86_64/include/sipi.h | #pragma once, inline const, rename packed struct. |
| src/arch/x86_64/include/interrupt.h | Update to delegate-based interrupt handlers + ETL singleton alias. |
| src/arch/x86_64/early_console.cpp | Switch early console to ETL putchar integration. |
| src/arch/x86_64/backtrace.cpp | Switch to new KernelElf member names + ETL singleton usage. |
| src/arch/x86_64/apic/io_apic.cpp | Replace raw IO with ETL IO ports and new formatting. |
| src/arch/x86_64/apic/include/io_apic.h | #pragma once, trailing returns, init defaults. |
| src/arch/x86_64/apic/include/apic.h | Add [[nodiscard]] + trailing returns and modernize members. |
| src/arch/x86_64/apic/README.md | Update docs to ETL singleton aliases. |
| src/arch/riscv64/timer.cpp | Switch timer registration to delegates + singleton aliases. |
| src/arch/riscv64/syscall.cpp | Modernize syscall handler signature. |
| src/arch/riscv64/include/interrupt.h | Delegate-based handler arrays + external IRQ API. |
| src/arch/riscv64/early_console.cpp | Switch early console output to etl_putchar. |
| src/arch/riscv64/boot.S | Stack sizing based on config constant (not fixed shift). |
| src/arch/riscv64/backtrace.cpp | Switch to new KernelElf member names + singleton usage. |
| src/arch/riscv64/arch_main.cpp | Switch to ETL singleton creation + format-string updates. |
| src/arch/aarch64/timer.cpp | Delegate-based timer handler + singleton usage. |
| src/arch/aarch64/syscall.cpp | Use std::array for syscall args; update dispatcher call. |
| src/arch/aarch64/interrupt.cpp | Add external IRQ registration + robust MMIO mapping error logs. |
| src/arch/aarch64/include/pl011_singleton.h | New PL011 singleton alias header for early console. |
| src/arch/aarch64/include/interrupt.h | Delegate-based IRQ handlers + expose GIC helper calls. |
| src/arch/aarch64/gic/README.md | Fix method naming in docs (SetUp). |
| src/arch/aarch64/early_console.cpp | Switch early console to new PL011 singleton and etl_putchar. |
| src/arch/aarch64/boot.S | Stack sizing based on config constant (not fixed shift). |
| src/arch/aarch64/backtrace.cpp | Switch to new KernelElf member names + singleton usage. |
| src/arch/aarch64/arch_main.cpp | Switch to ETL singleton creation + updated logging. |
| src/arch/CMakeLists.txt | Link arch to interrupt-controller subdirs + device drivers needed by arch. |
| src/arch/AGENTS.md | New architecture documentation. |
| src/CMakeLists.txt | Add memory/device/filesystem subdirectories and link targets. |
| docs/CMakeLists.txt | Rename Doxygen project/target from doc to docs. |
| docs/2_调试输出.md | Update docs to new singleton/console initialization. |
| docs/1_系统启动.md | Update boot-flow docs to new singleton usage. |
| docs/0_工具链.md | Remove cppcheck suppression mention. |
| doc/task_unit_test_new_design.md | Remove outdated task unit test design doc. |
| cmake/x86_64-gcc.cmake | Normalize CMake style and improve toolchain checks. |
| cmake/riscv64-gcc.cmake | Normalize CMake style and improve toolchain checks. |
| cmake/project_config.cmake | Add additional clean targets for bin/lib outputs. |
| cmake/functions.cmake | Generate rootfs.img and wire into QEMU dtb generation/run targets. |
| cmake/compile_config.cmake | Add ETL + FatFS compile defs and link dependencies; adjust -O2 in Release. |
| cmake/clang.cmake | Remove clang toolchain file. |
| cmake/3rd.cmake | Remove nanoprintf and cppcheck; add ETL + FatFS third-party integrations. |
| CMakePresets.json | Add QEMU device flags and attach generated rootfs.img drives; tweak defaults. |
| CMakeLists.txt | Switch subdirectory from doc/ to docs/. |
| AGENTS.md | Add repository-level agent documentation and conventions. |
| 3rd/optee/optee_os | Update submodule commit. |
| 3rd/optee/optee_client | Update submodule commit. |
| 3rd/optee/build | Update submodule commit. |
| 3rd/nanoprintf | Remove nanoprintf submodule reference. |
| 3rd/fatfs | Add FatFS submodule reference. |
| 3rd/etl | Add ETL submodule reference. |
| 3rd/dtc | Update submodule commit. |
| 3rd/cpu_io | Update submodule commit. |
| 3rd/MPMCQueue/test/test.cpp | Minor include ordering/spacing. |
| 3rd/MPMCQueue/test/CMakeLists.txt | Normalize CMake style. |
| 3rd/MPMCQueue/CMakeLists.txt | Normalize CMake style. |
| 3rd/EasyLogger | Add EasyLogger submodule reference. |
| .gitmodules | Remove nanoprintf; add fatfs/etl/EasyLogger submodules. |
| .github/workflows/workflow.yml | Update docs target name and GitHub Pages publish directory. |
Comment on lines
25
to
29
| // 检查 IRQ 是否在有效范围内 | ||
| auto max_entries = GetMaxRedirectionEntries(); | ||
| if (irq >= max_entries) { | ||
| klog::Err("IRQ %u exceeds maximum entries %u\n", irq, max_entries); | ||
| return; | ||
| klog::Err("IRQ {} exceeds maximum entries {}", irq, max_entries); | ||
| } |
Comment on lines
+26
to
32
| auto TimerInitSMP() -> void { | ||
| // 开启时钟中断 | ||
| cpu_io::Sie::Stie::Set(); | ||
|
|
||
| // 设置初次时钟中断时间 | ||
| sbi_set_timer(interval); | ||
| } |
Comment on lines
+23
to
+25
| if (strlen(path) >= kMaxPathLength) { | ||
| return std::unexpected(Error(ErrorCode::kFsInvalidPath)); | ||
| } |
Comment on lines
+40
to
+55
| char parent_path[512]; | ||
| char file_name[256]; | ||
| const char* last_slash = strrchr(path, '/'); | ||
| if (last_slash == nullptr || last_slash == path) { | ||
| strncpy(parent_path, "/", sizeof(parent_path)); | ||
| strncpy(file_name, path[0] == '/' ? path + 1 : path, sizeof(file_name)); | ||
| } else { | ||
| size_t parent_len = last_slash - path; | ||
| if (parent_len >= sizeof(parent_path)) { | ||
| parent_len = sizeof(parent_path) - 1; | ||
| } | ||
| strncpy(parent_path, path, parent_len); | ||
| parent_path[parent_len] = '\0'; | ||
| strncpy(file_name, last_slash + 1, sizeof(file_name)); | ||
| } | ||
| file_name[sizeof(file_name) - 1] = '\0'; |
| return std::unexpected(Error(ErrorCode::kOutOfMemory)); | ||
| } | ||
|
|
||
| strncpy(new_dentry->name, dir_name, sizeof(new_dentry->name) - 1); |
| // Allocate slot DMA buffer | ||
| auto [slot_size, slot_align] = | ||
| virtio::blk::VirtioBlk<>::GetRequiredSlotMemSize(); | ||
| slot_buffers_[idx] = kstd::make_unique<IoBuffer>(slot_size); |
Comment on lines
+44
to
+61
| auto* ptr = static_cast<uint8_t*>(buf); | ||
| for (uint32_t i = 0; i < count; ++i) { | ||
| auto result = dev_->Read(lba + i, ptr + i * kSectorSize); | ||
| if (!result) { | ||
| return std::unexpected(Error(result.error().code)); | ||
| } | ||
| } | ||
| return static_cast<size_t>(count) * kSectorSize; | ||
| } | ||
|
|
||
| auto WriteSectors(uint64_t lba, uint32_t count, const void* buf) | ||
| -> Expected<size_t> override { | ||
| const auto* ptr = static_cast<const uint8_t*>(buf); | ||
| for (uint32_t i = 0; i < count; ++i) { | ||
| auto result = dev_->Write(lba + i, ptr + i * kSectorSize); | ||
| if (!result) { | ||
| return std::unexpected(Error(result.error().code)); | ||
| } |
Comment on lines
+118
to
+123
| case GET_SECTOR_COUNT: | ||
| static_cast<LBA_t*>(buff)[0] = static_cast<LBA_t>(dev->GetSectorCount()); | ||
| return RES_OK; | ||
| case GET_SECTOR_SIZE: | ||
| static_cast<WORD*>(buff)[0] = static_cast<WORD>(dev->GetSectorSize()); | ||
| return RES_OK; |
Comment on lines
+67
to
+75
| -> Expected<DmaRegion> { | ||
| if (offset + len > size) { | ||
| return std::unexpected(Error{ErrorCode::kInvalidArgument}); | ||
| } | ||
| return DmaRegion{ | ||
| .virt = static_cast<uint8_t*>(virt) + offset, | ||
| .phys = phys + offset, | ||
| .size = len, | ||
| }; |
Comment on lines
+42
to
+46
| const char* last_slash = strrchr(path, '/'); | ||
| if (last_slash == nullptr || last_slash == path) { | ||
| strncpy(parent_path, "/", sizeof(parent_path)); | ||
| strncpy(file_name, path[0] == '/' ? path + 1 : path, sizeof(file_name)); | ||
| } else { |
Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
…ce, and DMA - io_apic: add early return after OOB IRQ check in SetIrqRedirection/MaskIrq/UnmaskIrq - mkdir: add NUL-termination after strncpy on dentry name - lookup: replace broken mount-point loop with FindByMountDentry - file_descriptor: fix open_count_ over-counting in SetupStandardFiles - io_buffer: fix size_t overflow in SubRegion bounds check - open/mkdir: reject path components exceeding buffer sizes - file_descriptor: use address-based lock ordering in move-assignment - virtio_driver: pass slot_align to IoBuffer for consistency - diskio: add nullptr guard for buff in disk_ioctl Signed-off-by: Niu Zhihong <zhihong@nzhnb.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Major refactoring and feature additions over the past month, focusing on replacing custom kernel infrastructure with the Embedded Template Library (ETL), rewriting the logging subsystem, overhauling the device framework, and adding a VFS/FatFS filesystem layer.
310 files changed, +19,521 / -12,892
Key Changes
1. ETL (Embedded Template Library) Integration
Full migration from custom
sk_stdcontainers and utilities to ETL, a production-grade embedded C++ library:sk_std::static_list,sk_std::vector,sk_std::priority_queuewithetl::list,etl::vector,etl::priority_queue,etl::flat_mapio::In/Outtoetl::io_port_ro/rwacross APIC, GIC, and VirtIOSingleton<T>→etl::singleton<T>with named aliases inkernel.hInterruptFuncpointer →etl::delegatefor type-safe interrupt callbacksTaskStatusenum →etl::fsmstate machine with well-defined transitionsCloneFlagsenum →etl::flagsfor type-safe bitmask operationsetl::observer-based tick and panic interfacesetl::message_routerID registry for lifecycle and VirtIO eventssk_std::unique_ptr(with array specialization) andsk_std::shared_ptr(with atomic reference counting)sk_stdimplementations and their tests2. Kernel Logging Rewrite (MPMC Lock-Free)
Complete rewrite of
kernel_log.hpp:{}placeholders replacing printf-style%d/%sklog::raw_err/LogLineRaw/LogStreamRawfor use in contexts where locking is unsafe (e.g.,DumpStack)etl_putcharshims for all three architectures3. Device Framework Overhaul
Eliminated the
device_frameworksubmodule and inlined all driver code:VirtioDriverclass with runtime device-type dispatch, replacing the old per-device-type classesvoid*DMA buffers with typedDmaRegion+VirtToPhystranslationsrc/device/into per-driver and per-type subdirectoriesetl::optional,etl::delegate,etl::vector,etl::flat_mapin driver registry and driver implementationsDriverDescriptor,DeviceStorage4. Filesystem Layer (VFS + RamFS + FatFS)
New filesystem infrastructure:
SpinLock-guarded operations, supporting mount/open/read/write/closeblock_device_provider5. Memory: IoBuffer Module
IoBuffer: RAII-managed aligned I/O buffers for DMA and device communicationdma_bufferfield inDeviceNodefor VirtIO block driver integrationIoBuffer::ToDmaRegion()for zero-copy DMA submission6. SMP & Boot
boot_taskinitialization,TimerInitmoved tomain7. Style & Code Quality
.cppandarch.h#pragma onceacross all headers[[nodiscard]],[[maybe_unused]],[[gnu::xxx]]replacing__attribute__((xxx))src/arch/,src/filesystem/,src/memory/sk_assertwith standardassertSubsystem Diff Summary
src/arch/src/device/src/filesystem/src/task/src/include/tests/src/memory/src/libc/+src/libcxx/Test Plan
cmake --preset build_riscv64 && cd build_riscv64 && make SimpleKernel && make runcmake --preset build_aarch64 && cd build_aarch64 && make SimpleKernel && make runcmake --preset build_x86_64 && cd build_x86_64 && make SimpleKernel && make runmake unit-teston host architecturepre-commit run --all-filespasses